package demo0;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:恋恋
 * Date:2022-09-16
 * Time:10:16
 */
class Animal{
    protected String name;
    public Animal(String name){
        this.name=name;
    }
}
interface IFlying{
    //默认的public abstract
    void fly();
}
interface IRunning{
    void run();
}
interface ISwimming{
    void swim();
}
//两析动物：既能跑，也能游
interface IAmphibious extends IRunning,ISwimming{
   void fun();
}
class Frog implements IAmphibious{
    @Override
    public void run() {

    }

    @Override
    public void swim() {

    }

    @Override
    public void fun() {

    }
}
//因为父类Animal的构造方法有参数，因此需重新写；应用接口IRunning，因此重写抽象方法
class cat extends Animal implements IRunning{
    public cat(String name) {
        super(name);
    }
    @Override
    public void run() {
        System.out.println(this.name+"正在用四条腿跑");
    }
}
class bird extends Animal implements IFlying{
    public bird(String name) {
        super(name);
    }
    @Override
    public void fly() {
        System.out.println(this.name+"正在用翅膀飞");
    }
}
//青蛙既能跑，又能跳（两嘻动物）
class Frog1 extends Animal implements IRunning,ISwimming{
    public Frog(String name) {
        super(name);
    }

    @Override
    public void run() {
        System.out.println(this.name+"正在往前跳");
    }

    @Override
    public void swim() {
        System.out.println(this.name+"正在蹬腿游泳");

    }
}
public class TestDemo {
    public static void main(String[] args) {
        Frog frog=new Frog("青蛙王子");
        frog.run();
        frog.swim();
    }
}
